package kisti.lod.classification.db;

import java.sql.SQLException;

import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;

/**
 * Stores the Databaste Connection (Singleton)
 * @author Sebastian
 *
 */
public class DBConnector {
	protected static ConnectionSource connectionSource = null; 
	protected static String databaseUrl = "jdbc:mysql://localhost/lod-classification?user=root";
	
	public static ConnectionSource getConnectionSource() throws SQLException {
		if(connectionSource == null) {
			setConnectionSource();
		}
		return connectionSource;
	}
	
	protected static void setConnectionSource() throws SQLException {
		connectionSource = new JdbcConnectionSource(databaseUrl);
	}
	
}
